import {
  Detail,
  Footer,
  ApplyForm,
  Header,
  PaymentMethod,
  SafeguardLiability,
  Tips,
} from "./components";
import { container } from "./index.module.less";
import { useRef, useState } from "react";

export const Insure = () => {
  const [submitVisible, setSubmitVisible] = useState(false);
  const applyFormRef = useRef(null);
  return (
    <div className={container}>
      <Header />
      <ApplyForm
        ref={applyFormRef}
        onSubmitVisibleChange={(val) => setSubmitVisible(val)}
      />
      <SafeguardLiability />
      <PaymentMethod />
      <Detail />
      <Footer
        showSubmit={!submitVisible}
        onSubmit={() => applyFormRef.current.submit()}
      />
      <Tips />
    </div>
  );
};
